//
//  RequestManager+GRAddress.m
//  YC_GRice
//
//  Created by luojinrong11 on 2018/7/16.
//  Copyright © 2018年 YeCai. All rights reserved.
//

#import "RequestManager+GRAddress.h"

@implementation RequestManager (GRAddress)
+(void)getAddressWithType:(NSInteger )type ParentID:(NSInteger)parentId ComplectionHander:(RequestBlock)complectinHander{
    NSString * url = [NSString stringWithFormat:@"%@v1/address/linkage/%ld/%ld",GRiceAPI,type,parentId];
    [self TouristsRequestWithURLString:url Method:GR_GET Paramers:nil completionHandler:complectinHander];
}

+(void)createAddress:(NSDictionary *)dic ComplectionHander:(RequestBlock)complectinHander{
    NSString * url = [NSString stringWithFormat:@"%@v1/address/save",GRiceAPI];
    [self MembershipRequestWithURLString:url Method:GR_POST Paramers:dic completionHandler:complectinHander];
}

+(void)getMyAddressList:(RequestBlock)complectinHander{
    NSString * url= [NSString stringWithFormat:@"%@v1/address/list",GRiceAPI];
    [self MembershipRequestWithURLString:url Method:GR_POST Paramers:nil completionHandler:complectinHander];
}
+(void)deleteAddressWithAddressId:(NSInteger)addressId ComplectionHander:(RequestBlock)complectinHander{
    NSString * url = [NSString stringWithFormat:@"%@v1/address/delete/%ld",GRiceAPI,addressId];
    [self MembershipRequestWithURLString:url Method:GR_GET Paramers:nil completionHandler:complectinHander];
}
+(void)getAddressInfo:(NSInteger)addressId ComplectionHander:(RequestBlock)complectinHander{
    NSString * url = [NSString stringWithFormat:@"%@v1/address/%ld",GRiceAPI,addressId];
    [self MembershipRequestWithURLString:url Method:GR_GET Paramers:nil completionHandler:complectinHander];
    
}

+(void)updateAddress:(NSDictionary*)dic ComplectionHander:(RequestBlock)complectinHander{
    NSString * url = [NSString stringWithFormat:@"%@v1/address/update",GRiceAPI];
    [self MembershipRequestWithURLString:url Method:GR_POST Paramers:dic completionHandler:complectinHander];
}

+(void)setDefaultAddress:(NSInteger)addressId ComplectionHander:(RequestBlock)complectinHander{
    NSString * url = [NSString stringWithFormat:@"%@v1/address/default/%ld",GRiceAPI,addressId];
    [self MembershipRequestWithURLString:url Method:GR_GET Paramers:nil completionHandler:complectinHander];
}

@end
